<?php
class Core_Data_Mappers_Menuitem extends Core_Data_Mappers_Abstract {
	protected $_businessclass ='Core_Business_Menuitem';
	protected $_modelclass ='Core_Data_Models_Menuitem';
	protected $_map=array("Id"=>"id","Label"=>"label","Url"=>"url","Order"=>"order","Disabled"=>"disabled","Parentid"=>"parentid");
	
	public function exists($object) {
		if($object instanceof $this->_businessclass) {
			if($this->find($object)) 
				return true;
		}
		return false;
		
	}
	
	public function find($id) {
		$data = $this->getDbTable()->fetchRow(array("id=?"=>$id));
		if(isset($data)&&count($data)==1)
			return $this->map($data);
		else
			return null;
			
	}
	
	public function add($object) {
		throw new Exception("add method of Core_Data_Mappers_Menuitem object mustn't implemented");
	}
	public function edit($object) {
		throw new Exception("Edit method of Core_Data_Mappers_Menuitem object mustn't implemented");
	}
}